package team.nmsg.ge.system.init.shiro;

import java.io.Serializable;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;

public class ShiroSessionManager extends DefaultWebSessionManager{
	
	@Override
	protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
		
		if( request instanceof HttpServletRequest  ) {
			HttpServletRequest req = (HttpServletRequest) request;
			String JSESSIONID = req.getHeader("JSESSIONID");
			if( JSESSIONID!=null && !"NULL".equals(JSESSIONID)  ) {
				return JSESSIONID;
			}
		}
		
		return super.getSessionId(request, response);
		
		
	}

}
